package com.atguigu.flink.chapter07.util;

import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.List;

/**
 * @Author lzc
 * @Date 2022/7/9 9:03
 */
public class AtguiguUtil {
    public static <T> List<T> toList(Iterable<T> it){
        List<T> result = new ArrayList<>();
    
//        it.forEach(e -> result.add(e));
        it.forEach(result::add);
        
        return result;
    }
    
    public static String toDateTimeString(long ts) {
        return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(ts);
    }
    
    public static String toDateString(Long ts) {
        return new SimpleDateFormat("yyyy-MM-dd").format(ts);
    }
}
